export default (a, b) => {
  var east = {
    1: 1,
    3: 2,
    4: 3,
    9: 4,
  };
  var west = {
    2: 1,
    7: 2,
    8: 3,
    6: 4,
  };
  //判断是否同宫位
  if ((east[a] && east[b]) || (west[a] && west[b])) {
    var calc = east[a] ? east : west;
    var cha = calc[a] > calc[b] ? calc[a] - calc[b] : calc[b] - calc[a];
    if (cha == 0) {
      return "3";
    } else if (cha == 2) {
      return "2";
    } else if (
      cha == 1 &&
      (calc[a] == 1 || calc[b] == 1 || calc[a] == 4 || calc[b] == 4)
    ) {
      return "1";
    } else {
      return "0";
    }
  } else {
    var calc1; //与a绑定
    var calc2; //与b绑定
    if (east[a]) {
      calc1 = east;
      calc2 = west;
    } else {
      calc1 = west;
      calc2 = east;
    }
    //判断绝命;
    var cha = calc1[a] > calc2[b] ? calc1[a] - calc2[b] : calc2[b] - calc1[a];
    if (cha == 0) {
      return "7";
    } else if (cha == 2) {
      return "4";
    } else if (
      cha == 1 &&
      (calc1[a] == 1 || calc2[b] == 1 || calc1[a] == 4 || calc2[b] == 4)
    ) {
      return "6";
    } else {
      return "5";
    }
  }
};
